package gatperdut.chato.core.interpreter.actions.generic;

import gatperdut.chato.constants.CSConstantsCommandResult.CommandExecutionResult;
import gatperdut.chato.core.characters.BaseController;
import gatperdut.chato.core.interpreter.grammar.comminfo.CommunicationInfo;

public abstract class CommunicationAction extends Action {

    public CommunicationAction( CommunicationInfo info, BaseController controller ) {
        super( info, controller );
    }

    public boolean invalidSpeech() {
        if ( getInfo().getSpeech() == null || getInfo().getSpeech().matches( "[' ' | '\t']+" ) || getInfo().getSpeech().equals( "" ) ) {
            return true;
        }
        else {
            return false;
        }
    }

    @Override
    public abstract CommandExecutionResult perform();

    @Override
    public boolean interruptsCrafting() {
        return false;
    }

    @Override
    public CommunicationInfo getInfo() {
        return (CommunicationInfo) super.getInfo();
    }
}
